<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <script>
    const [a=1,b=2]=[]
    console.log(a,b);
    //默认值的生效条件：只有当一个数组成员严格等于（===）undefind时，对应的默认值才会生效
    const [c=1,d=1]=[3,0]
    console.log(c,d);
    const [e,f]=[3,null]
    console.log(e,f);
    const [g=1,h=1]=[2]
    console.log(g,h);
    //如果默认值是表达式，默认值表达式是惰性求值
    const fun=()=>{
      console.log('我被执行了');
      return 2
    }
    const [x=fun()]=[1]
    console.log(x);
  </script>  
</body>
</html>